JBoss Forge Introduction and addon development

Vineet Reynolds

  • Senior Software Engineer, JBoss Developer Experience, Red Hat
  • Contributor to
    • JBoss Forge - Scaffolding and others
    • JBoss Developer experience materials
  • Maintainer of TicketMonster
Notes
  • I’m Vineet, and I work as an engineer for JBoss at Red Hat
  • I work primarily in the JBoss Developer experience team.
  • Primarily on JBoss Forge and JBoss Developer Framework to make it easier for developers to get started with Java EE development.

Objectives
Discover JBoss Forge. Learn how to extend it for your needs.

Notes
  • This is a talk focussed on showcasing JBoss Forge to newbies, and help them discover features in JBoss Forge.
  • Eventually, they will learn on extending JBoss Forge to build in capabilities that would suit their needs.
  • This talk is for you if you’re a beginner and you want a tool that helps you make fewer mistakes.
  • The contents of the talk also apply if you’re a pro and you want a tool that automates away the trivial bits.
  • The talk is relevant even if you have unique needs, and also when your company or customers have unique needs.

Let’s talk about productivity

6322092360 b5ce3a9d83 b
Every one wants development to be simple.
Notes
  • People walk away from complex and bloated programming models.
  • Does EJB 2 ring a bell ? What about JSF 1.x ?
  • In contrast, you have Ruby on Rails, Django, or even micro-frameworks like Flask and Sinatra.
  • And you now have people clamouring to use NodeJS because it allows you to share logic between the client and the server.
6322092360 b5ce3a9d83 b
Some expect to learn one language, a few APIs, maybe one framework, and meet all demands with a limited set of primitives.
Notes
  • In most of the previous examples, simplicity came at a price.
  • The frameworks work best in a set of scenarios, namely in web-app development, but not for everything.
9620369338 3438a8e3d0 b
But in reality - One language is hardly sufficient. APIs are numerous. Frameworks are dime a dozen.
Notes
  • These is a context in which you use the languages, APIs and frameworks.
  • Different contexts require different solutions.
  • You wouldn’t really want to write your execution engines for enterprise apps in JavaScript today.
  • Nor would you want to write business rules in a programming language.
9620369338 3438a8e3d0 b
And it takes time to discover best practices relevant to your development stack.
Notes
  • Learning these takes time.
  • Discovering how to use them effectively takes even more time.
5248624748 885057e7a5 b
Achieving expertise is not easy. It takes time.
Notes
  • If you look at the Dreyfus model of skill acquisition, most people start off as novices.
  • They learn the rules on how to use their toolkits. But they may not know when to apply them.
  • Eventually they begin to gain contextual knowledge on when to apply the rules.
  • And finally, they formulate new rules as they mature to become experts in their domains.
5248624748 885057e7a5 b
Scaling expertise across teams is even tougher.
Notes
  • Scaling the Dreyfus model across to teams and organizations takes even more time.
  • You need competent people to pass on their knowledge to the less fortunate ones.
  • Self-discovery takes time.
  • Self-discovery without automation to aid in gaining competence takes time.

Speaking of Forge…

Notes
  • Through the automation of repetitive tasks, Forge helps you focus on the activities that matter to your business.
  • You don’t have to waste time to figure out what snippets of code really matter in using a particular feature of some framework or library.
  • Mundane tasks prone to errors can be abstracted away.
  • Forge does not constrain you to a particular language or runtime, even though it is written in Java and ships with several commands hugely relevant to Java EE.
  • Forge is available in various form factors to help different audiences - a CLI tool for command-line junkies and an Eclipse plugin for heavy-IDE users.
  • More IDE integrations are planned.

Install as an Eclipse plugin…

qrcode

Use this update site - Eclipse Kepler+

Notes
  • You can install this as an Eclipse plugin.
  • Scan the QR code to obtain the update site and point Eclipse to it.

Download and get started with the CLI tool

qrcode-cli

Download the CLI ZIP

Notes
  • You can also install this as a command-line tool.
  • Scan the QR code to obtain the download link.
  • To install, extract the zip to a location.
  • export FORGE_HOME=<install_location>
  • export PATH=$FORGE_HOME/bin:$PATH
  • You can now start Forge as forge

JBoss Forge
in Action

3743235527 eed35ccb71 o
Create a project
Notes
  • $ project-new --named helloforge
3901150974 2693a76db9 o
Setup JPA, CDI, BV etc.
Notes
  • $ jpa-setup --provider Hibernate
  • $ constraint-setup --providers Generic\ Java\ EE
  • $ cdi-setup
  • $ servlet-setup
  • $ ejb-setup
  • $ scaffold-setup --provider Faces
  • These commands are contextual as well. Try running scaffold-setup without running the previous ones.
  • Forge commands can be made to operate on the state of the project without making assumptions.
4680568796 b5fa0c2885 o
Scaffold an application
Notes
  • $ scaffold-setup --provider Faces
  • We already ran this, but you should be aware that scaffolding is a very powerful command.
  • In Forge, scaffolding can be considered as a composite command.
  • It can compose several individually meaningful commands into a composite operation whose end-result is even more meaningful.
  • Of course, you could write scaffold providers without employing these principles ;-)
  • Note that you can write your own scaffold providers.

Looking back…

Notes
  • Unlike Maven archetypes that offer limited producivity gains in project bootstrapping, Forge goes beyond just setting up the project.
  • While it is easier to create a new project with facets in Forge, it is even easier to perform developer-facing tasks.
  • None of the APIs in Forge will force you to operate on some premise. Even if they do for valid reason, (say, work with Java source files), you can write your own and plug into the modular runtime employed by Forge.
  • This is unlike other tooling. If you’re a framework author, you can build tooling around your framework using Forge.

Looking back…

Notes
  • Skills levels dont really matter when you want to get more productive.
  • You may think that switching to languages with more concise syntax will make your productive by cutting down on typing.
  • Forge can help you even more, by making operations themselves more concise, so you gain more productivity combining contextual operations with concise syntax.
  • For example, you’ve already seen how Forge manages properties and relations in JPA entities. No longer do you need to create a field, it’s getter and an optional setter. Forge understands properties in the context of JPA and how to manage them.
Forge2.0High LevelArchitecture
Before we extend Forge, let’s understand it.
Notes
  • Forge use the Furance runtime to manage addons.
  • Furnace is closely linked to the JBoss Modules project, offering a modular classloading environement.
  • Capabilities can be added by deploying new addons.
  • Want a new scaffold provider? Deploy a new addon.
  • Want support for a new language? Deploy another addon.
2713475713 392003b2da o
Engineer your workflow. Write your own addons

Recap

JBoss Forge :

Questions ?

Getting in touch

Credits

Slides generated with Asciidoctor and DZSlides backend
Original slide template - Dan Allen & Sarah White

Credits

Survey crew, 1952 by Seattle Municipal Archives, used under CC BY 2.0
Lake Forest Park Reservoir under construction, 1962 by Seattle Municipal Archives, used under CC BY 2.0
Municipal building under construction, 1961 by Seattle Municipal Archives, used under CC BY 2.0 / Cropped from original
Engineer working on plans for Lake Union area, circa 1960s by Seattle Municipal Archives, used under CC BY 2.0

Credits

RAAF History by Timothy Swinson, used under CC BY / Desaturated from original
Human ornithopter by Tom Wigley, used under CC BY-NC-SA 2.0
Cockpit of a Concorde supersonic passenger jet by Lars Plougmann, used under CC BY-SA 2.0

JBoss Forge